@extends('admin.layout')

@section('content_header')
    customer history
@stop

@section('content')

<p></p>

    @component('admin.historysearch') @endcomponent
    <table class="table table-bordered">
    	
    	<thead>
    		<th>id</th>
    		
    		<th>入力情報</th>
    		<th>スコア</th>
             <th>日経のスコア</th>
            <th>ランダムスコア</th>
            
            <th>（⾦利）最小値</th>
            <th>（⾦利）最大値</th>
            <th>住宅購⼊可能額最小値</th>
            <th>住宅購⼊可能額最大値</th>
           
            
        
            <th>会社ID</th>
            <th></th>
    	</thead>
    	<tbody>
    		
    		@foreach($datas as $v)
    			<tr>
    				<td>{{$v->id}}</td>
                    <td> <button data-view="1" data-id="{{$v->id}}">查看</button> </td>
                    <td>{{$v->score}}</td>
                    <td>{{$v->nikkei_score}}</td>
                    <td>{{$v->random_score}}</td>
                    <td>{{$v->min_interests}}</td>
                    <td>{{$v->max_interests}}</td>
                    <td>{{$v->min_total_payment}}</td>
                    <td>{{$v->max_total_payment}}</td>
                    <td>{{$v->customer->company->company_id??''}}</td>
                    <td></td>    				
    			</tr>
    		@endforeach
    	</tbody>
    </table>

<p>{{$datas->links()}}</p>
    
@stop

@section('js')
@parent


<script>
    $(function(){
        $("button[data-view=1]").on('click', function(){
            const id = $(this).data('id');
            Swal.fire({
                title: 'Please Wait ...!',
                html: 'data uploading',// add html attribute if you want or remove
                allowOutsideClick: false,
                onBeforeOpen: () => {

                    $.ajax({
                        url:"/admin/history/"+id,
                        success: res => {
                            console.log(res)
                            Swal.fire({
                                html:res
                            })
                        }
                    });
                },
            });
        })
    })
    
</script>
    
@stop


